package com.nets.client;

import com.nets.packet.Packet;
import com.nets.util.LogUtil;

import java.net.InetSocketAddress;

/**
 * @author sig
 * @since 2016/9/18
 */
public class ClientTest {

    public static void sendIP(Packet req) {
        if (null == req.getChannel()) return;
        Packet res = new Packet(req);
        req.getChannel().writeAndFlush(res);
        InetSocketAddress address = (InetSocketAddress) req.getChannel().remoteAddress();
        LogUtil.console.info("The client IP:" + address.getHostString());
    }

    public static void heartbeat(Packet req) {
        if (null == req.getChannel()) return;
        Packet res = new Packet(req);
        req.getChannel().writeAndFlush(res);
    }
}
